package com.suian.spring.common.invocation;

import com.suian.spring.common.service.Runner;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class AppRunnerHandler implements InvocationHandler {
    private Runner runner;

    public void setRunner(Runner runner) {
        this.runner = runner;
    }

    public AppRunnerHandler() {
    }

    public AppRunnerHandler(Runner runner) {
        this.runner = runner;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("方法执行前");
        Object result = method.invoke(runner, args);
        System.out.println("方法执行后");
        return result;
    }
}
